﻿using System.Collections.Generic;
using BigEgg.Framework.Foundation;
using System.Linq;

namespace UnitTestDemo.Applications.Humans
{
    public class Human : Animal
    {
        #region Fields
        private readonly List<ContactInfo> contacts;
        private string output;
        #endregion

        public Human(string name)
            : base("Human", name)
        {
            this.contacts = new List<ContactInfo>();
            this.output = string.Empty;
        }

        #region Properties
        public List<ContactInfo> Contacts
        { 
            get { return this.contacts; } 
        }

        public string Output
        {
            get { return output; }
        }
        #endregion

        #region Methods

        #region Public Methods
        public override bool CanRead()
        {
            return true;
        }
        #endregion

        #region Internal Methods
        internal void CleanDirtyContacts()
        {
            this.contacts.RemoveAll(x => !string.IsNullOrEmpty(x.Validate()));
        }
        #endregion

        #region Protected Methods
        protected override void ReadCore(string document)
        {
            this.output = document;

            RaisePropertyChanged("Output");
        }
        #endregion

        #endregion
    }
}
